package com.wxboot.game.eliminate.modules.web;

import com.wxboot.game.eliminate.base.BombAreaPoint;
import com.wxboot.game.eliminate.base.JellyContext;
import com.wxboot.game.eliminate.modules.service.JellyEliminateService;
import com.wxboot.game.eliminate.modules.web.convert.BombAreaPointConvert;
import com.wxboot.game.eliminate.modules.web.req.JellyMoveReq;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/")
public class GameStartController {

    @Resource
    private JellyEliminateService jellyEliminateService;

    @RequestMapping("start-level")
    public String startLevel(Integer level, JellyContext context) {
        return jellyEliminateService.startJellyGameLevel(level, context);
    }

    @RequestMapping("move")
    public String move(JellyMoveReq req, JellyContext context) {
        BombAreaPoint bombAreaPoint = BombAreaPointConvert.convert(req);
        String moveResult = jellyEliminateService.moveJelly(req.getSessionId(), context, bombAreaPoint);

        return moveResult;
    }


}
